{% extends 'base.html' %}
{% block title %}
    高中成绩处理
{% endblock %}
{% block head %}
    <style>
        th, td {
            text-align: center;
        }
    </style>
{% endblock %}
{% block content %}
    <div class="container mt-3">
        <div class="row">
            <div class="col mx-auto" style="max-width: 800px">
                <label for="" class="mx-auto h5">请选择有效的excel格式文件</label>
                <form action="{{ url_for('process_by_good_scores') }}" method="post" enctype="multipart/form-data">
                    <div class="input-group mb-3">
                        <label class="col mx-auto" style="width:800px">
                            <input type="file" class="form-control" placeholder="请输入原始成绩路径"
                                   aria-describedby="input" name="path_file" value="{{ path_file }}">
                            <input type="text" class="form-control" placeholder="请输入文科有效分"
                                   aria-describedby="input" name="arts_scores" value="{{ arts_scores }}">
                            <input type="text" class="form-control" placeholder="请输入理科有效分"
                                   aria-describedby="input" name="science_scores" value="{{ science_scores }}">
                        </label>
                        <button type="submit" class="btn btn-outline-info" id="input">查看</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    {% if df_html %}
        <div class="container mt-sm-2">
            <div class="row">
                <div class="col h3 text-center text-black-50">
                    数据更新时间：{{ update_time }}
                    <br>
                    <hr>
                    数据来源：{{ path_file.filename }}
                    <br>
                    文科有效分：{{ arts_scores }}
                    <br>
                    理科有效分：{{ science_scores }}
                    <hr>
                </div>
            </div>
        </div>

        <div class="container mt-5 text-center">
            <div class="row">
                <div class="col">
                    <h3>文科成绩数据分析</h3>
                </div>
            </div>
        </div>
    {% else %}
        <div class="container mt-5 text-center text-warning">
            <div class="row">
                <div class="col h4">
                    {{ weekday }}
                </div>
            </div>
        </div>
    {% endif %}
    <div class="container mt-3">
        <div class="row">
            <div class="col text-center table-responsive text-nowrap">
                <hr>
                <div class="table-responsive">
                    {{ df_html|safe }}
                    {{ av_html|safe }}
                </div>
            </div>
        </div>
    </div>
    {% if df_science_html %}
        <div class="container mt-5 text-center">
            <div class="row">
                <div class="col">
                    <h3>理科成绩数据分析</h3>
                </div>
            </div>
        </div>
    {% endif %}
    <div class="container mt-3">
        <div class="row">
            <div class="col text-center table-responsive text-nowrap">
                <hr>
                <div class="table-responsive">
                    {{ df_science_html|safe }}
                    {{ av_science_html|safe }}
                </div>
            </div>
        </div>
    </div>
    {% if exam_processed %}
        <div class="container mt-5 text-center text-warning">
            <div class="row">
                <div class="col">
                    <h5>数据处理完成！
                        <button class="btn btn-outline-info">
                            <a href="{{ exam_processed }}" style="text-decoration: none">导出excel表</a>
                        </button>
                    </h5>
                </div>
            </div>
        </div>
    {% endif %}
{% endblock %}